<!DOCTYPE HTML>
<html>
<#include "headImport.html">
<body>
<script type="text/javascript" src="static/cms/www/default/js/jquery.cookie.js"></script>
<script type="text/javascript" src="static/cms/www/default/js/base64.js"></script>
<#include "newHeaderSys.html">
<div class="container11001  clearfix" style="width:100%;height:580px;<#if matchProject?? && matchProject.logoPath??> background: url(${matchProject.logoPath!}) center center no-repeat;<#else>background-color:#D9D9D9; </#if>" >
	<@loginContent/>
</div>
<#include "footer.html">
</body>
</html>

<#macro loginContent>
<div id="content_c">
<style>
.login-container{
    border-radius: 5px;
    -moz-border-radius: 5px;
    background-clip: padding-box;
    width: 390px;
    height: 317px;
    background: #fff;
    border: 1px solid #eaeaea;
    position: absolute;
    top: 160px;
    left: 845px;
}
.login-container .title {
    margin: 25px;
    text-align: center;
    font-family: 微软雅黑;
    font-weight:700;
    font-size:16px;
    color: #4d92fa;
}
.el-input__inner {
    -moz-appearance: none;
    appearance: none;
    background-color: #f1f7f5;
    background-image: none;
    border: 1px solid #d9d9d9;
    color: #1f2d3d;
    height: 36px;
    float: left;
    padding: 3px 10px;
    width: 254px;
    font-size: 15px;
    margin-top:10px; 
}
.el-form-item__img {
	float: left;
    border: 1px solid #d9d9d9;
    height: 36px;
    padding: 3px 10px;
    margin-left: 27px;
    margin-top:10px; 
    background-color: #d9ebfa;
    border-radius: 5px;
}
.el-form-item__img img {
	margin-top: 5px;
    width: 25px;
}
.el-button {
    border: 1px solid #bfcbd9;
    padding: 10px 15px;
    color: #fff;
    background-color: #1C6DC9;
    border-color: #1C6DC9;
    margin-left: 27px;
    margin-top: 25px;
    width: 323px;
    cursor: pointer;
}
.el-input__check {
     width: 28px;
    margin-top: 20px;
    margin-left: 250px
}
</style>
<form  class="login-container" id="csform">
	<input name="sshdId" type="hidden" value="${(matchProject.id)!}"/>
    <input name="isRemember"  id="isRemember" type="hidden" value="false"/>
	<h3  class="title">用户登录</h3>
	<div  class="el-form-item is-required">
		<div class="el-form-item__content" style="margin-left: 0px;">
			<div class="el-form-item__img">
				<img src="static/cms/www/default/img/sshd/user.png"/>
			</div>
			<div  class="el-input">
				<input type="text" name="loginName" placeholder="账户名" autocomplete="off" class="el-input__inner" value=""/>
			</div>
		</div>
	</div>
	<div  class="el-form-item is-required">
		<div class="el-form-item__content" style="margin-left: 0px;">
			<div class="el-form-item__img">
				<img src="static/cms/www/default/img/sshd/pwd.png"/>
			</div>
			<div  class="el-input">
				<input type="password" name="password" placeholder="密码" autocomplete="off" class="el-input__inner" value=""/>
			</div>
		</div>
	</div>
	<!--
	<div  class="el-form-item is-required">
		<div class="el-form-item__content" style="margin-left: 0px;">
			<div class="el-form-item__img">
				测试用的角色
			</div>
			<div  class="el-input">
			  <select name="linkType">
  				<option value ="csgly">参赛管理员</option>
  				<option value ="psgly">评审管理员</option>
  				<option value="ssgly">赛事管理员</option>
  				<option value="zzh">子帐号</option>
				</select>
			</div>
		</div>
	</div>
	-->
	<div  class="el-input">
		<input type="checkbox" name="isRemember2" id="isRemember2" class="el-input__check"/><span style="font-size: 15px;color:#777">记住密码</span>
	</div>
	<div  class="el-form-item" style="width: 100%;">
		<!---->
		<div class="el-form-item__content" style="margin-left: 0px;">
			<button  type="button" class="el-button" onclick="login()"><span style="font-size: 16px;">登&nbsp;录</span></button>
			<!---->
		</div>
	</div>
</form>
</div>
<script type="text/javascript">
// var h = window.screen.height - 80;
// console.log(h);
// $("#content_c").css("height",h + "px")


var base64 = new Base64();
function login() {
	if ($("input[name='loginName']").val() == "") {
		$.alert("帐号不能为空，请输入");
		$("input[name='loginName']").focus();
		return;
	} 
	if($("input[name='password']").val() == "") {
		$.alert("密码不能为空，请输入");
		$("input[name='password']").focus();
		return;
	}
	$("#isRemember").val($("#isRemember2").is(':checked'));
	//ajax异步提交  
	$.ajax({
		type : "POST",
		url : "matchLogin.action?loginPs",
		data : $("#csform").serialize(), //序列化               
		error : function(request) { // 设置表单提交出错 
			$.alert('登陆错误'); //登录错误提示信息
		},
		success : function(data) {
			if (data.success) {
				if ($("#isRemember2").is(':checked')) {
　　　　				$.cookie("username", base64.encode($("input[name='loginName']").val()), { expires: 7 });
　　　　				$.cookie("password", base64.encode($("input[name='password']").val()), { expires: 7 });
　　				}
　			　	else {
　　　　				$.cookie("username", "", { expires: -1 });
　　　　				$.cookie("password", "", { expires: -1 });
　　				}
				window.location.href = "matchManager.do?"+data.obj+"&sshdId=${(matchProject.id)!}";
			} else {
				$.alert(data.msg)
			}
			
		}
	});
}
　　$().ready(function(){
　　　　//获取cookie的值
　　　　var username = base64.decode($.cookie('username'));
　　　　var password = base64.decode($.cookie('password'));

　　　　//将获取的值填充入输入框中
　　　　$("input[name='loginName']").val(username);
　　　　$("input[name='password']").val(password); 
　　　　if(username != null && username != '' && password != null && password != ''){//选中保存秘密的复选框
　　　　　　$("#isRemember2").attr('checked',true);
　　　}
	});
</script>
</#macro>